package com.hunt.testspringboot.service;

import com.hunt.testspringboot.bean.User;
import com.hunt.testspringboot.dao.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {

    @Autowired
    private UserRepository userRepository;

    public List<User> findAllUser(){
      return  userRepository.findAll();
    }

    public User findUserByUaername(String username){
        return userRepository.findUserByUsername(username);
    }

    public void save(User user) {
        userRepository.save(user);
    }
}
